package com.bigbirdmed.cloud.common.core.constant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 删除状态
 *
 * @author medbot
 */
@Getter
@AllArgsConstructor
public enum DelFlagEnum {

	/**
	 * 已删除
	 */
	DELETED(1, "已删除"),
	/**
	 * 未删除
	 */
	NOT_DELETED(2, "未删除");

	private final Integer code;
	private final String name;

	/**
	 * 根据code查询枚举实例
	 * @param code
	 * @return
	 */
	public static DelFlagEnum getEnumByCode(Integer code) {
		if(code == null){
			return null;
		}
		for (DelFlagEnum instance : values()) {
			if (instance.getCode().equals(code)) {
				return instance;
			}
		}
		return null;
	}
}
